package com.orangelife.mobile.hourlyEmployee.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.TextView;

import com.curry.orangelife.mobile.R;
import com.orangelife.mobile.app.application.CurryApplication;
import com.orangelife.mobile.common.activity.OrangeLifeBaseActivity;

public class ServiceIntroductionActivity extends OrangeLifeBaseActivity {

    /** 标题中间 */
    private TextView tvTitle;
    /** 标题右边 */
    private ImageView ivTitleRight;
    /***/
    private WebView wvServiceIntroduction;

    String url = "";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_hourly_employee_service_introduction);
        initeView();
        findView();
    }

    private void initeView() {
        tvTitle = (TextView) findViewById(R.id.tv_title);
        ivTitleRight = (ImageView) findViewById(R.id.iv_title_right);
        wvServiceIntroduction = (WebView) findViewById(R.id.wvServiceIntroduction);
    }

    private void findView() {
        tvTitle.setText(R.string.service_introduction);
        ivTitleRight.setVisibility(View.INVISIBLE);
        Intent intent = getIntent();
        int activ = intent.getIntExtra("activ", 3);
        if (activ == 1) {
            url = intent.getStringExtra("url");
            //房屋清洁的服务说明
            wvServiceIntroduction.loadUrl(url);
        } else if (activ == 2) {
            //房屋维修的服务说明
            wvServiceIntroduction.loadUrl(CurryApplication.getInstance().getServerURL()+ "/orangelife_web/views/share/repairDesc.html");
        }
        wvServiceIntroduction.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                //返回值是true的时候控制去WebView打开，为false调用系统浏览器或第三方浏览器
                view.loadUrl(url);
                return true;
            }
        });

    }
}
